using NetProtocol.Enum;
using NetProtocol.POD;
using System.Collections.Generic;

namespace IQIGame.Onigao.GamePlay
{
    public class DynLevelHeroEntity : BaseDynLevelEntity
    {
        public override int mcid => 0;
        public override int mapSymbolCid => TableCenter.mapUiEntity.PlayerCid;
        public override IReadOnlyList<int> offeredQuests => null;
        public long playerId { get; private set; }
        public GameScenePhasing gameScenePhasing { get; set; }

        public bool isInMainPhasing => gameScenePhasing == GameScenePhasing.Main;

        public static DynLevelHeroEntity CreateByPOD(LevelEntityPOD pod)
        {
            DynLevelHeroEntity dynEntity = new DynLevelHeroEntity();
            dynEntity.id = pod.id;
            dynEntity.UpdateByPOD(pod);
            return dynEntity;
        }

        public void UpdateByPOD(LevelEntityPOD pod)
        {
            if (pod.hero != null)
            {
                this.playerId = pod.hero.playerId;
            }

            this.x = pod.x;
            this.y = pod.y;
            this.z = pod.z;
            this.dirEuler = pod.dirEuler;
        }
    }
}
